<html>
<head>
    <script>
        function test()
        {
            if (window.testRunner)
                testRunner.dumpAsText();

            var edit = document.getElementById("edit");
            while (edit.nextSibling)
                edit.nextSibling.parentNode.removeChild(edit.nextSibling);

            var source = document.getElementById("source");
            var selection = getSelection();

            selection.collapse(source.firstChild, 5);
            selection.modify("extend", "forward", "word");

            document.execCommand("Copy");
            edit.focus();
            document.execCommand("SelectAll");
            document.execCommand("Paste");
        }
    </script>
</head>
<body onload="test()">
<p>
    Test for <i><a href="rdar://problem/6864786">rdar://problem/6864786</a>: REGRESSION: Crash below ApplyStyleCommand::applyInlineStyleToRange when reviewing a patch in Bugzilla</i>.
</p>
<p>
    The test passes if it does not crash.
</p>
<div id="source" style="font-size: 36px">Copy the second word in this sentence.</div>
<pre id="edit" style="-webkit-user-modify: read-write-plaintext-only;">Select All here and paste<br></pre>
</body>
</html>
